<script type="text/javascript">
function app_search()
{
    var obj = document.getElementById('search_form');
    obj.action = $('#search_type').val();
    obj.submit();
}
function change_search(val)
{
    var arr = {
        'app':['date_range', 'packagename', 'channel'],
        'app_groupby_channel':['date_range', 'packagename', 'channel'],
        'app_versions':['date_range', 'packagename'],
        'channel':['date_range', 'channel'],
        'channel_apps_toplist':['date_range', 'channel', 'top'],
        'apps_toplist':['date', 'top'],
    };
    $("#search_form span[id$='_span']").hide();
    for (var i=0;i<arr[val].length;i++)
    {
        $('#'+arr[val][i]+'_span').show();
    }
    $('#search_type').val(val);
}
$(function(){
    var urls = location.pathname.split('/');
    change_search(urls[urls.length-1]);
});
</script>
        <div style="margin:10px 3% 0;padding:10px;background:#ECECEC;border:1px solid #E2E2E2">
            <form method='GET' action='app' id="search_form">
			    <span id="date_range_span">
			         从<input type="text" value="<{$start_date}>" id="date1" name='start_date' style="width:80px;" />至
			         <input type="text" value="<{$end_date}>" id="date2" name='end_date' style="width:80px;"/>
			    </span>
			    <span id="date_span">日期：<input type="text" id="date1" value="<{$date}>" name='date' style="width:80px;" /></span>
			    <span id="packagename_span">包名：<input type="text" value="<{$request.packageName}>" name="packageName" style="width:150px;"></span>
			    <span id="channel_span">渠道名：<input type="text" value="<{$request.channel}>" name="channel" style="width:130px;"></span>
			    <span id="top_span">TOP:<input type="text" value="<{$top}>" name="top" size="3"></span>
			    <select onchange="change_search(this.value)" id="search_type">
			         <option value="app">总下载查询</option>
			         <option value="app_groupby_channel">分渠道查询</option>
			         <option value="app_versions">版本查询</option>
			         <option value="channel">渠道下载查询</option>
			         <option value="channel_apps_toplist">渠道应用下载排行</option>
			         <option value="apps_toplist">所有应用下载排行</option>
			    </select>
			    <input class="effect-update" type='submit' value='查询' onclick="app_search()" style="padding:3px 5px;">
			</form>
        </div>
